<html>

<head>

    <title>windowdemo</title>

    <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>

</head>
<body>
<script>
/*1 OS*/
var os = require('os')
document.write('Our computer is: ', os.platform())

/*2 spawn*/
var spawn = require('child_process').spawn;
ipconfig = spawn('ipconfig');
ipconfig.stdout.on('data', function (data) {
document.write('<br>' + data);
});


/*3 exec*/
var exec = require('child_process').exec;
// var cmdStr = 'net start mysql';
var cmdStr = 'net stop mysql';
exec(cmdStr, function(err,stdout,stderr){
    if(err) {
        document.write('<br> starting mysql service error:'+stderr);
    } else {
        document.write('<br> starting mysql service success:'+stdout);

        var gui = require('nw.gui');
        var win = gui.Window.get();
        var new_win = gui.Window.get(
          window.open('http://baidu.com')
        );
    }
});
</script>
</body>
</html>
